Skip to content

Conversation

@86xsk
Copy link
Contributor

@86xsk 86xsk commented Jan 27, 2026

Description

  • Makes the return type of lex_catch (and callers that use it as a fallback) reflect its infallibility.
  • Removes error handling that's become no longer necessary as a result.
  • Deduplicates nearly identical code in Weir lexing and PlainEnglish parsing by extracting common functionality into new function lex_with().

How Has This Been Tested?

  • cargo test

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes

86xsk added 4 commits January 27, 2026 15:52
`lex_catch()` is infallible. By extension, functions that use it as
a fallback are also infallible. As such, returning an option is
misleading and results in callers having to implement unnecessary
error handling.

BREAKING CHANGE: Changes the return type of `lex_weir_token`,
`lex_english_token`, and `lex_catch`. They now return `FoundToken`
instead of `Option<FoundToken>`. Also removes the unused `_source`
argument from `lex_catch`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant